using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class EnemyCanvas : MonoBehaviour
{
    public Image healthImage;

    private CharacterStatus _status;

    private void Awake()
    {
        _status = GetComponentInParent<CharacterStatus>();
    }

    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        float targetFill = _status.health / _status.maxHealth;
        healthImage.fillAmount = targetFill; // Mathf.SmoothStep(healthImage.fillAmount, targetFill, 10f * Time.deltaTime);   
    }

    private void LateUpdate()
    {
        transform.forward = Camera.main.transform.forward;
    }
}
